﻿#region Using Directives

    using System;

    using Csla;

#endregion

namespace MarketPulse.BusinessLogic.Common.Criteria
{
    /// <summary>
    /// Criteria class specifying the criteria allowable for a search for a Visit object
    /// </summary>
    [Serializable]
    public class VisitCriteria : CriteriaBase<VisitCriteria>
    {

        #region Constructors

            /// <summary>
            /// Default constructor for this class
            /// </summary>
            /// <param name="visitGuid">The Guid of the Visit to associate with this criteria</param>                     
            public VisitCriteria(Guid visitGuid)
            {
                VisitGUID = visitGuid;
            }

            /// <summary>
            /// Overloaded constructor for this class that accepts extra parameters 
            /// </summary>
            /// <param name="visitGuid">The Guid of the Visit to associate with this criteria</param>
            /// <param name="roundGuid">The Guid of the Round to associate with this criteria</param>   
            /// <param name="branchGuid">The Guid of the Branch to associate with this criteria</param>   
            /// <param name="userGuid">The Guid of the User to associate with this criteria</param>                  
            public VisitCriteria(Guid? visitGuid, Guid? roundGuid, Guid? branchGuid, Guid? userGuid)
            {
                // Null shorthand = 
                // a = (b != null) ? b : c;

                // Set the values if they are not null
                //VisitGUID = (visitGuid.HasValue) ? visitGuid : null;

                //RoundGUID = (roundGuid.HasValue) ? roundGuid : null;

                //BranchGUID = (branchGuid.HasValue) ? branchGuid : null;

                //UserGUID = (userGuid.HasValue) ? userGuid : null;

                VisitGUID = visitGuid;
                RoundGUID = roundGuid;
                BranchGUID = branchGuid;
                UserGUID = userGuid;
                                                                                
            }

        #endregion

        #region Properties

            /// <summary>
            /// This Guid is used to identify the Visit object associated with this criteria
            /// </summary>
            public static PropertyInfo<Guid?> VisitGUIDProperty = RegisterProperty<Guid?>(p => p.VisitGUID);
            /// <summary>
            /// This Guid is used to identify the Visit object associated with this criteria
            /// </summary>
            public Guid? VisitGUID
            {
                get { return ReadProperty(VisitGUIDProperty); }
                private set { LoadProperty(VisitGUIDProperty, value); }
            }

            /// <summary>
            /// This Guid is used to identify the Round object associated with this criteria
            /// </summary>
            public static PropertyInfo<Guid?> RoundGUIDProperty = RegisterProperty<Guid?>(p => p.RoundGUID);
            /// <summary>
            /// This Guid is used to identify the Round object associated with this criteria
            /// </summary>
            public Guid? RoundGUID
            {
                get { return ReadProperty(RoundGUIDProperty); }
                private set { LoadProperty(RoundGUIDProperty, value); }
            }

            /// <summary>
            /// This Guid is used to identify the Branch object associated with this criteria
            /// </summary>
            public static PropertyInfo<Guid?> BranchGUIDProperty = RegisterProperty<Guid?>(p => p.BranchGUID);
            /// <summary>
            /// This Guid is used to identify the Branch object associated with this criteria
            /// </summary>
            public Guid? BranchGUID
            {
                get { return ReadProperty(BranchGUIDProperty); }
                private set { LoadProperty(BranchGUIDProperty, value); }
            }

            /// <summary>
            /// This Guid is used to identify the User object associated with this criteria
            /// </summary>
            public static PropertyInfo<Guid?> UserGUIDProperty = RegisterProperty<Guid?>(p => p.UserGUID);
            /// <summary>
            /// This Guid is used to identify the User object associated with this criteria
            /// </summary>
            public Guid? UserGUID
            {
                get { return ReadProperty(UserGUIDProperty); }
                private set { LoadProperty(UserGUIDProperty, value); }
            }

        #endregion

    }
}
